let v1:string | number;

let v2:string = "234";
v1 = v2;
v1 = 123;

function sum2(a:number,b:number) {
    console.log(a + b);
}


sum2(2,v1);

var str5 = '1' 
var num5:number;

// 类型断言：语法要求需要先往上走，再往下走
// 断言会违反数据类型限制: 可以粗暴地解决问题
num5 = <number><any>str5;
console.log(typeof num5); // string

// {name: "Hydra",age: 35} 
// {name: "Hydra",age:35,sex: "男"}